/*
 * logon_cfg.h
 *
 *  Created on: Dec 19, 2013
 *      Author: killerg
 */

#ifndef LOGIN_CFG_H_
#define LOGIN_CFG_H_


#include "share/cfg_file.h"

struct logon_cfg_t {
    bool init(const char* prefix) {
        cfg_file_t file;
        if (!file.load("logon.txt", prefix))
            return false;

        ListenClientIp    = file.get_str("listen_client_ip", "0.0.0.0");
        ListenClientPort  = file.get_int("listen_client_port", 9000);
        ListenConsoleIp   = file.get_str("listen_console_ip", "0.0.0.0");
        ListenConsolePort = file.get_int("listen_console_port", 9007);
        ListenServerIp    = file.get_str("listen_server_ip", "0.0.0.0");
        ListenServerPort  = file.get_int("listen_server_port", 8001);
        AuthIp            = file.get_str("auth_ip", "127.0.0.1");
        AuthPort          = file.get_int("auth_port", 8000);
        DecodeClient      = file.get_bool("decode_client", false);
        ClientVer		  = file.get_int("client_ver", 1);

        return true;
    }
    void destroy() {
    }


    std::string ListenClientIp;
    int32_t ListenClientPort;
    std::string ListenConsoleIp;
    int32_t ListenConsolePort;
    std::string ListenServerIp;
    int32_t ListenServerPort;
    std::string AuthIp;
    int32_t AuthPort;
    bool DecodeClient;
    int32_t ClientVer;
};


#endif /* LOGIN_CFG_H_ */
